package memento;

import pojo.User;

// 发起人，状态变化者
public class UserInfoOriginator {
    // 当前状态
    private String userid;
    private String userpwd;

    // 保存到备忘录
    public User saveToMemento(){
        return new User(userid, userpwd);
    }

    // 返回备忘录状态
    public void restoreFromMemento(User memento){
        this.userid = memento.getUserid();
        this.userpwd = memento.getUserpwd();
    }

    public String getUserid() {
        return userid;
    }

    public void setUserid(String userid) {
        this.userid = userid;
    }

    public String getUserpwd() {
        return userpwd;
    }

    public void setUserpwd(String userpwd) {
        this.userpwd = userpwd;
    }

    @Override
    public String toString() {
        return "UserInfoOriginator{" +
                "userid='" + userid + '\'' +
                ", userpwd='" + userpwd +
                '}';
    }
}
